/**
 * create by young (young2f@outlook.com) on 2023/5/2
 */
'use strict';
const moment = require('moment');

const str = moment().add(-1, 'day').utc().startOf('days').toISOString();
const ts = moment(str).valueOf();
console.log('kkk',ts);
console.log('kkkeee',time(moment().utc().startOf('days').toISOString()));
console.log('kkk222',time(str));
console.log('str',str);

function time(strTime) {
    if (!strTime) {
        return '';

    }

    var nowDate = new Date(strTime + '+0800');

    if (nowDate == 'Invalid Date') {
        strTime = strTime.replace(/T/g, ' ');

        strTime = strTime.replace(/-/g, '/');

        strTime = strTime.replace(/\.\d+/, ' ');

        nowDate = new Date(strTime + '+0800');

    }

    return nowDate;

}
